//
//  XuanzeshouhuoTableViewCell.m
//  tianjin
//
//  Created by 鞠超 on 16/8/10.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "XuanzeshouhuoTableViewCell.h"

@implementation XuanzeshouhuoTableViewCell

- (instancetype )initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if(self)
    {
        [self p_setupView];
    }
    
    return self;
}

- (void )p_setupView
{
    self.name = [[UILabel alloc] init];
    self.name.text = @"涉及到好几十";
    self.name.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.name];
    
    self.tel = [[UILabel alloc] init];
    self.tel.textAlignment = NSTextAlignmentRight;
    self.tel.font = [UIFont systemFontOfSize:16];
    self.tel.text = @"12345678900";
    [self.contentView addSubview:self.tel];
    
    self.address = [[UILabel alloc] init];
    self.address.font = [UIFont systemFontOfSize:15];
    self.address.textColor = [UIColor grayColor];
    self.address.text = @"山东临沂兰山区河东区罗庄区";
    [self.contentView addSubview:self.address];
    
    self.view_line1 = [[UIView alloc] init];
    self.view_line1.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.view_line1];
    
    self.btn_select = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.btn_select setBackgroundImage:[UIImage imageNamed:@"weixuanzhong@2x.png"] forState:(UIControlStateNormal)];
    [self.contentView addSubview:self.btn_select];
    
    self.lbl_moren = [[UILabel alloc] init];
    self.lbl_moren.text = @"设为默认";
    self.lbl_moren.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.lbl_moren];
    
    self.view_line2 = [[UIView alloc] init];
    self.view_line2.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.view_line2];
    
    //
    self.lbl_bianji = [[UILabel alloc] init];
    self.lbl_bianji.text = @"编辑";
    self.lbl_bianji.textColor = [UIColor grayColor];
    self.lbl_bianji.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.lbl_bianji];
    
    self.image_bianji = [[UIImageView alloc] init];
    self.image_bianji.image = [UIImage imageNamed:@"bianji@2x.png"];
    [self.contentView addSubview:self.image_bianji];
    
    //
    self.lbl_shanchu = [[UILabel alloc] init];
    self.lbl_shanchu.text = @"删除";
    self.lbl_shanchu.textColor = [UIColor grayColor];
    self.lbl_shanchu.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.lbl_shanchu];
    
    self.image_shanchu = [[UIImageView alloc] init];
    self.image_shanchu.image = [UIImage imageNamed:@"shanchudizhi@2x.png"];
    [self.contentView addSubview:self.image_shanchu];
    
    //
    self.btn_bianji = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.contentView addSubview:self.btn_bianji];
    
    //
    self.btn_shanchu = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.contentView addSubview:self.btn_shanchu];
}

- (void )layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat length_x = (SCREEN_WIDTH - 20) / 2;
    
    self.name.frame = CGRectMake(10, 10, length_x, 15);
    
    self.tel.frame = CGRectMake(CGRectGetMaxX(self.name.frame), 10, length_x, 15);
    
    self.address.frame = CGRectMake(10, CGRectGetMaxY(self.name.frame) + 10, SCREEN_WIDTH - 20, 15);
    
    self.view_line1.frame = CGRectMake(0, CGRectGetMaxY(self.address.frame) + 10, SCREEN_WIDTH, 1);
    
    self.btn_select.frame = CGRectMake(40, CGRectGetMaxY(self.view_line1.frame) + 10, 25, 25);
    
    self.lbl_moren.frame = CGRectMake(CGRectGetMaxX(self.btn_select.frame) + 10, CGRectGetMaxY(self.view_line1.frame) + 15, 60, 15);
    
    self.view_line2.frame = CGRectMake(0, CGRectGetMaxY(self.btn_select.frame) + 10, SCREEN_WIDTH, 10);
    
    self.lbl_bianji.frame = CGRectMake(SCREEN_WIDTH - 10 - 30, CGRectGetMaxY(self.view_line1.frame) + 15, 30, 15);
    
    self.image_bianji.frame = CGRectMake(SCREEN_WIDTH - 40 - 10 - 20, CGRectGetMaxY(self.view_line1.frame) + 12.5, 20, 20);
    
    self.lbl_shanchu.frame = CGRectMake(SCREEN_WIDTH - 70 - 10 - 30, CGRectGetMaxY(self.view_line1.frame) + 15, 30, 15);
    
    self.image_shanchu.frame = CGRectMake(SCREEN_WIDTH - 110 - 10 - 20, CGRectGetMaxY(self.view_line1.frame) + 12.5, 20, 20);
    
    self.btn_bianji.frame = CGRectMake(SCREEN_WIDTH - 10 - 60, CGRectGetMaxY(self.view_line1.frame) + 5, 60, 35);
    
    self.btn_shanchu.frame = CGRectMake(SCREEN_WIDTH - 70 - 10 - 60, CGRectGetMaxY(self.view_line1.frame) + 5, 60, 35);
}








@end
